package com.notebad.ui;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;

import com.notebad.R;
import com.notebad.TestGeolocalisation;

/**
 * @author Alex
 *
 *	Main apps Activity. This activity is loading first (see AndroidManifest.xml file). 
 */
public class NoteBad extends Activity {

	private static final String TAG = "NoteBad";

	private ImageButton editStartButton;
	private ImageButton listStartButton;
	private ImageButton imgStartButton;
	private ImageButton recordStartButton;

	private Button testStartButton; 

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		editStartButton = (ImageButton) findViewById(R.id.StartEdit);
		listStartButton = (ImageButton) findViewById(R.id.StartList);
		imgStartButton = (ImageButton) findViewById(R.id.StartImg);
		recordStartButton = (ImageButton) findViewById(R.id.StartRecord);
		testStartButton = (Button) findViewById(R.id.StartTest);

		OnClickListener listener = new OnClickListener() {

			@Override
			public void onClick(View view) {
				switch(view.getId()) {
				case R.id.StartEdit:
					//TODO Add here the Activity
					/*
					 * Intent i = new Intent(this, ActivityClass.class);
					 * startActivityForResult(i, ACTIVITY_ID);
					 */
					Log.d(TAG, "Start Edit");
					return;
				case R.id.StartRecord:
					//TODO Add here the Activity
					/*
					 * Intent i = new Intent(this, ActivityClass.class);
					 * startActivityForResult(i, ACTIVITY_ID);
					 */
					Log.d(TAG, "Start Record");
					Intent audio = new Intent(NoteBad.this, AudioView.class);
			        startActivity(audio);
					return;
				case R.id.StartImg:
					//TODO Add here the Activity
					/*
					 * Intent i = new Intent(this, ActivityClass.class);
					 * startActivityForResult(i, ACTIVITY_ID);
					 */
					Log.d(TAG, "Start Picture");
					Intent cam = new Intent(NoteBad.this, CameraView.class);
					startActivity(cam);
					return;
				case R.id.StartList:
					//TODO Add here the Activity
					/*
					 * Intent i = new Intent(this, ActivityClass.class);
					 * startActivityForResult(i, ACTIVITY_ID);
					 */
					Log.d(TAG, "Start List");
					Intent list = new Intent(NoteBad.this, NoteList.class);
					startActivity(list);
					return;

				case R.id.StartTest:
					//TODO Add here the Activity
					/*
					 * Intent i = new Intent(this, ActivityClass.class);
					 * startActivityForResult(i, ACTIVITY_ID);
					 */
					Log.d(TAG, "Start Test");
					Intent i = new Intent(NoteBad.this, TestGeolocalisation.class);
					startActivity(i);
					return;
				}
			}
		};

		editStartButton.setOnClickListener(listener);
		listStartButton.setOnClickListener(listener);
		imgStartButton.setOnClickListener(listener);
		recordStartButton.setOnClickListener(listener);
		testStartButton.setOnClickListener(listener);
	}
}